package com.mrd.payClient.utils;

import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.beanutils.PropertyUtilsBean;

public class CoverUtils {

	public static Map getValue(Object thisObj) {
		   Map<String, Object> params = new HashMap<String, Object>(0); 
           try { 
               PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean(); 
               PropertyDescriptor[] descriptors = propertyUtilsBean.getPropertyDescriptors(thisObj); 
               for (int i = 0; i < descriptors.length; i++) { 
                   String name = descriptors[i].getName(); 
                   if (!"class".equals(name)) { 
                       params.put(name, propertyUtilsBean.getNestedProperty(thisObj, name)); 
                   } 
               } 
           } catch (Exception e) { 
               e.printStackTrace(); 
           } 
           return params; 
	}

}
